<%@ page language="java"
         import="com.ruohi.manage.DBType,com.ruohi.manage.PoolManager,com.ruohi.manage.Tools,com.ruohi.util.common.CommonForm,com.ruohi.util.common.CommonString"
         pageEncoding="UTF-8" %>
<%@ page import="com.ruohi.util.common.Env" %>
<%@ page import="com.ruohi.util.dbutil.DBHelper" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.TreeMap" %>
<%
	Connection connection = null;
	DBHelper dbHelper = DBHelper.getInstance();
	Map model = new HashMap();
	Map categorys = new TreeMap();
	String tableName = "gift_supplier";
	String channelUUID = CommonString.getFormatPara(request.getParameter("channel_uuid"));
	Map adminInfo = (Map)session.getAttribute("adminInfo");
	try{
		connection = PoolManager.getConnection(DBType.getDBTypeByEnum("106013"));
		String id = CommonString.getFormatPara(request.getParameter("id"));
		if(null!=id&&!"".equals(id)){
			model = dbHelper.getMap(" select * from "+tableName+" where uuid = ? ",new Object [] {id} , connection);
		}
		if("".equals(channelUUID)&&null!=model){
			channelUUID = (String)model.get("channel_uuid");
		}
		
		String no = CommonString.getFormatPara(model.get("no"));
		if(no.equals("")){
			no = "g"+Tools.getNo(tableName,"106013",1);
		}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><%=Env.getInstance().getProperty("project_name") %></title>
<link rel="stylesheet" type="text/css" href="/plugin/other/highslide/highslide.css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/plugin/area/city/citys.js"></script>
<script type="text/javascript" charset="utf-8" src="/plugin/editor/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="/plugin/editor/ueditor/editor_all_min.js"></script>
<link rel="stylesheet" type="text/css" href="/plugin/editor/ueditor/themes/default/ueditor.css"/>
</head>

<body style="margin: 0;padding: 0; overflow-y:auto; *overflow-y:hidden;">
<form name="theform" id="theform" action="/backend/action/crud.jsp?enumNo=106013">
  <div class="formDiv">
    <div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">基础信息</span> </div>
    <div class="formLeft"><span style="color:#F00">* </span>供应商名称</div>
    <div class="formRight" style="width:190px">
      <input type="text" dataType="Require" msg="请输入品牌名称" class="jr_text" name="zd_name" id="zd_name" value="<%=CommonString.getFormatPara(model.get("name")) %>" maxlength="50"/>
    </div>
    <div class="formLeft"><span style="color:#F00">* </span>供应商编号(自动)</div>
    <div class="formRight" style="width:190px">
      <input type="text" name="zd_no" class="jr_text" readonly="readonly" id="zd_no" value="<%=no %>"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">联系人</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_link_man" id="zd_link_man" value="<%=CommonString.getFormatPara(model.get("link_man")) %>" maxlength="50"/>
    </div>
    <div class="formLeft">职位</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_position" id="zd_position" value="<%=CommonString.getFormatPara(model.get("position")) %>" maxlength="50"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">手机</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_mobile" id="zd_mobile" value="<%=CommonString.getFormatPara(model.get("mobile")) %>" maxlength="50"/>
    </div>
    <div class="formLeft">电话</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_tel" id="zd_tel" value="<%=CommonString.getFormatPara(model.get("tel")) %>" maxlength="50"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">传真</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_fax" id="zd_fax" value="<%=CommonString.getFormatPara(model.get("fax")) %>" maxlength="50"/>
    </div>
    <div class="formLeft">邮箱</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_email" id="zd_email" value="<%=CommonString.getFormatPara(model.get("email")) %>" maxlength="50"/>
    </div>
    <div style="clear:left;"></div>
    
    <div class="formLeft">QQ</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_qq" id="zd_qq" value="<%=CommonString.getFormatPara(model.get("qq")) %>" maxlength="50"/>
    </div>
    <div class="formLeft">旺旺号</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_wangwang_num" id="zd_wangwang_num" value="<%=CommonString.getFormatPara(model.get("wangwang_num")) %>" maxlength="50"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">省<span class="span2">&nbsp;</span>市</div>
    <div class="formRight" style="width:200px">
      <select name="zd_province" class="jr_select" id="zd_province" onChange="set_city(this,this.value,theform.zd_city,'');" style="width:200px; *margin-left:5px"  dataType="Require"  msg="请选择省份">
        <option value="安徽">安徽</option>
        <option value="北京">北京</option>
        <option value="重庆">重庆</option>
        <option value="福建">福建</option>
        <option value="甘肃">甘肃</option>
        <option value="广东">广东</option>
        <option value="广西">广西</option>
        <option value="贵州">贵州</option>
        <option value="海南">海南</option>
        <option value="河北">河北</option>
        <option value="黑龙江">黑龙江</option>
        <option value="河南">河南</option>
        <option value="湖北">湖北</option>
        <option value="湖南">湖南</option>
        <option value="内蒙古">内蒙古</option>
        <option value="江苏">江苏</option>
        <option value="江西">江西</option>
        <option value="吉林">吉林</option>
        <option value="辽宁">辽宁</option>
        <option value="宁夏">宁夏</option>
        <option value="青海">青海</option>
        <option value="山西">山西</option>
        <option value="山东">山东</option>
        <option value="上海">上海</option>
        <option value="四川">四川</option>
        <option value="天津">天津</option>
        <option value="西藏">西藏</option>
        <option value="新疆">新疆</option>
        <option value="云南">云南</option>
        <option value="浙江">浙江</option>
        <option value="陕西">陕西</option>
        <option value="台湾">台湾</option>
        <option value="香港">香港</option>
        <option value="澳门">澳门</option>
        <option value="海外">海外</option>
      </select>
    </div>
    <div class="formRight"  style="width:160px;">
      <select  name="zd_city" id="zd_city"  class="jr_select" style="width:160px;">
        <option value="">选择城市</option>
      </select>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">办公地址</div>
    <div class="formRight">
      <input type="text" class="jr_text" name="zd_address" id="zd_address" value="<%=CommonString.getFormatPara(model.get("address")) %>" maxlength="500"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">工厂地址</div>
    <div class="formRight">
      <input type="text" class="jr_text" name="zd_fac_address" id="zd_fac_address" value="<%=CommonString.getFormatPara(model.get("fac_address")) %>" maxlength="500"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">邮编</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_postcode" id="zd_postcode" value="<%=CommonString.getFormatPara(model.get("postcode")) %>" maxlength="50"/>
    </div>
    <div class="formLeft">网址</div>
    <div class="formRight" style="width:190px">
      <input type="text" class="jr_text" name="zd_url" id="zd_url" value="<%=CommonString.getFormatPara(model.get("url")) %>" maxlength="50"/>
    </div>
    <div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">企业支付账号信息</span> </div>
    <div class="formLeft">支付宝</div>
    <div class="formRight" style="width:190px;">
      <input type="text" class="jr_text" name="zd_alipay" id="zd_alipay" value="<%=CommonString.getFormatPara(model.get("alipay")) %>" maxlength="50"/>
    </div>
    <div class="formLeft">开户银行</div>
    <div class="formRight" style="width:190px;">
      <input type="text" class="jr_text" name="zd_bank" id="zd_bank" value="<%=CommonString.getFormatPara(model.get("bank")) %>" maxlength="50"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">银行账号</div>
    <div class="formRight" style="width:190px;">
      <input type="text" class="jr_text" name="zd_bank_num" id="zd_bank_num" value="<%=CommonString.getFormatPara(model.get("bank_num")) %>" maxlength="50"/>
    </div>
    <div class="formLeft">姓名</div>
    <div class="formRight" style="width:190px;">
      <input type="text" class="jr_text" name="zd_bank_name" id="zd_bank_name" value="<%=CommonString.getFormatPara(model.get("bank_name")) %>" maxlength="50"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">备注</div>
    <div class="formRight" style="height:70px">
      <textarea class="jr_textarea" style="height:70px" name="zd_remark" id="zd_remark" dataType='Limit' min="0" max="300" msg='备注不能超过300字' ><%=CommonString.getFormatPara(model.get("remark")) %></textarea>
    </div>
    <div style="clear:left;"></div>
    <div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">企业资质信息</span> </div>
    <div class="formLeft">法人</div>
    <div class="formRight" style="width:190px;">
      <input type="text" class="jr_text" name="zd_legal_person" id="zd_legal_person" value="<%=CommonString.getFormatPara(model.get("legal_person")) %>" maxlength="50"/>
    </div>
    <div class="formLeft">营业执照注册号</div>
    <div class="formRight" style="width:190px;">
      <input type="text" class="jr_text" name="zd_business_license" id="zd_business_license" value="<%=CommonString.getFormatPara(model.get("business_license")) %>" maxlength="50"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">税号</div>
    <div class="formRight" style="width:190px;">
      <input type="text" class="jr_text" name="zd_duty_paragraph" id="zd_duty_paragraph" value="<%=CommonString.getFormatPara(model.get("duty_paragraph")) %>" maxlength="50"/>
    </div>
    <div class="formLeft">组织机构代码</div>
    <div class="formRight" style="width:190px;">
      <input type="text" class="jr_text" name="zd_bar_num" id="zd_bar_num" value="<%=CommonString.getFormatPara(model.get("bar_num")) %>" maxlength="50"/>
    </div>
    <div style="clear:left;"></div>
    <div class="group"> <span><img src="/plugin/ui/ligerUI/ligerUI/skins/icons/communication.gif" /></span> <span class="groupTitle">扩展信息</span> </div>    
    <div class="formLeft">供应商品类别</div>
    <div class="formRight">
      <input type="text" class="jr_text" name="zd_category_name" id="zd_category_name" value="<%=CommonString.getFormatPara(model.get("category_name")) %>" maxlength="500"/>
    </div>
    <div class="formRight" style="width:30px">
    	<a href="javascript:void(0)" onclick='jrSelf("../gift_category/category_select.jsp?category=<%=CommonString.getFormatPara(model.get("category")) %>","选择供应商品类别",300,450);'><input style="margin-right: 5px;color:#666" type="button" class="btn" value="选择类别" /></a>
    </div>
    <div style="clear:left;"></div>  
    <div class="formLeft">供应商介绍</div>
    <div class="formRight" style="height:70px">
      <textarea class="jr_textarea" style="height:70px" name="zd_intro" id="zd_intro" dataType='Limit' min="0" max="2000" msg='类别介绍不能超过2000字' ><%=CommonString.getFormatPara(model.get("intro")) %></textarea>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">主营产品</div>
    <div class="formRight">
      <input type="text" class="jr_text" name="zd_main_product" id="zd_main_product" value="<%=CommonString.getFormatPara(model.get("main_product")) %>" maxlength="500"/>
    </div>
    <div style="clear:left;"></div>
    <div class="formLeft">是否有效</div>
    <div class="formRight" style="width:190px"> <%=CommonForm.createIsRadio(CommonString.getFormatPara(model.get("is_show")),"zd_is_show") %> </div>
  </div>
  <input type="hidden" name="tableName" id="tableName" value="<%=tableName %>" />
  <input type="hidden" name="zd_id" id="zd_id" value="<%=CommonString.getFormatPara(model.get("id")) %>" />
  <input type="hidden" name="zd_category" id="zd_category" value="<%=CommonString.getFormatPara(model.get("category")) %>" />
  <input type="hidden" name="zd_channel_uuid" id="zd_channel_uuid" value="<%=channelUUID %>" />
  <input type="hidden" name="eventAfter" id="eventAfter" value="updAppSupplierGift" />
</form>
</body>
</html>
<script type="text/javascript" src="/plugin/jquery/jquery.form.js"></script>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="/backend/scripts/common.js?tab" type="text/javascript"></script>
<script src="/plugin/validator/wofoshan/validator.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/plugin/other/highslide/highslide.min.js"></script>
<script type="text/javascript" src="http://img.52sdskj.com/plugin/upload/jr_upload.js"></script>
<script type="text/javascript">
	hs.graphicsDir = '/plugin/other/highslide/graphics/';
	hs.wrapperClassName = 'wide-border';
	jQuery("#equi_img").JrUpload({
        remotUrl: "http://img.52sdskj.com/upload.jsp",
		folder : "saygou" ,
		watermark:false,
		callback : "setEquiImg"
	});
	function setEquiImg(data){
        var imgUrl = "http://img.52sdskj.com" + data;
		jQuery("#a_img").attr("href",imgUrl);
		jQuery("#zd_img").val(imgUrl);
	}
	function doSub(){
		var rs = Validator.Validate(document.getElementById("theform"),1);
		if(rs){
			jQuery("#theform").ajaxSubmit({
					type : "POST",
					async : false ,
					success : function(data) {
						var rs = parseInt(jQuery.trim(data), 10);
						if (rs > 0) {
							jrSuccess("保存成功！");
							<%
							if("".equals(id)){
								%>
							window.location.reload();
								<%
							}
							%>
						} 
					}
				});
		}
	}
	
	jQuery.getScript("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js",function(){
			var province = "<%=CommonString.getFormatPara(model.get("province")) %>";
			if(province == ""){
				province = remote_ip_info["province"];
			}
			var city = "<%=CommonString.getFormatPara(model.get("city")) %>";
			if(city == ""){
				city = remote_ip_info["city"];
			}
			jQuery("#zd_province option:contains("+province+")").attr("selected",true);
			set_city(document.getElementById("zd_province"),document.getElementById("zd_province").value,document.theform.zd_city,'');
			document.getElementById("zd_city").value = city;
	}) ;

	function smallToBig(o,id){
		jQuery(o).attr("href",jQuery("#"+id).val());
		return hs.expand(o);
	}
	
	//当前页面打开层		
	function jrSelf(url, title, width, height){
		jQuery.ligerDialog.open({
					height : height,
					url : url,
					width : width,
					showMax : false,
					showToggle : false,
					showMin : false,
					isResize : false,
					modal : true,
					title : title,
					buttons : [{
						text : '确定',
						onclick : function(item, dialog) {
							dialog.frame.doSub(dialog);
							//var ifid = parent.tab.getSelectedTabItemID();
							//parent.document.getElementById(ifid).contentWindow.grid.loadData();
						}
					}]
				});	
	}
</script>
<%
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		dbHelper.freeConnection(connection);
	}
%>